added optional substring exempt path checking#54
Open
vdinica-mdsol wants to merge 2 commits intomainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds optional substring/prefix matching functionality for exempt paths in the MAuth middleware. When exempt_prefix_match=True is enabled, paths that start with exempt prefixes (e.g., /health matching /health/live) will bypass authentication, while preventing false matches (e.g., /api not matching /api-admin).
Key changes:
- Added
is_exempt_request_path()utility function for prefix-based path matching - Updated WSGI and ASGI middlewares to support
exempt_prefix_matchparameter - Added comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| mauth_client/utils.py | Added is_exempt_request_path() function to handle prefix matching with path separator validation |
| mauth_client/middlewares/wsgi.py | Added exempt_prefix_match parameter and integrated prefix matching logic |
| mauth_client/middlewares/asgi.py | Added exempt_prefix_match parameter and integrated prefix matching logic |
| tests/utils_test.py | Added comprehensive test suite for is_exempt_request_path() covering edge cases |
| tests/middlewares/wsgi_test.py | Added integration tests for WSGI middleware with prefix matching enabled |
| tests/middlewares/asgi_test.py | Added integration tests for ASGI middleware with prefix matching enabled |
| pyproject.toml | Bumped version from 1.6.6 to 1.6.7 |
| CHANGELOG.md | Documented the new feature in version 1.6.7 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Author
|
PR opened for discussions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Using exact path matching for exempt paths does not provide a flexible way of specifying which request paths should be exempt from mauth checks.
Added an optional substring based check.